<%@ page language="java" contentType="text/html; charset=utf-8 " pageEncoding="utf-8" import="domain.Room"%>
<html>
	<head>
		<meta charset="utf-8">
		<base href="<%=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/" %>"/>
		<title>信息采集系统</title>
	</head>
	<script type = "text/javascript">
	function messageLoad(){
        	        var message = '<%=request.getParameter("msg") %>';
        	        if(message == 'success'){
        	        alert("注册成功，请登录！");
        	        }
        	        if(message == 'unSuccess'){
        	        alert("注册失败！");
        	        }
        	}
	</script>
	<style type="text/css">
		body{padding:0px;margin:0px;}
		.bgdiv{
			background:url(image/background.png) no-repeat;
			position: fixed;
			width: 100%;
			height: 100%;
			background-size:100% 100%;
		}
		.loginbox{
			position: relative;
			width: 80%;
			left: 10%;
			height: 250px;
			top: 20%;
			border-radius: 10px;
			box-shadow: rgba(0, 0, 0, 0.08) 1px 2px 4px 0px;
			background-color: white;
			opacity: 0.7;
			text-align: center;
		}
		.title{
			position: relative;
			top: 10%;
			font-weight: 600;
		}
		button{
			border-width: 0px;
			    width: 70px;
			    height: 25px;
			    background: inherit;
			    background-color: rgba(0, 207, 226, 1);
			    border: none;
			    border-radius: 50px;
			    -moz-box-shadow: none;
			    -webkit-box-shadow: none;
			    box-shadow: none;
			    font-size: 14px;
			    color: #FFFFFF;
				margin-top: 5px;
		}
		input{
						width: 100%;
		                border: 1px solid #ccc;
		                padding: 7px 0px;
		                border-radius: 3px;
		                padding-left:5px;
		                -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
		                box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
		                -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
		                -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
		                transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s
		            }
		            input:focus{
		                    border-color: #66afe9;
		                    outline: 0;
		                    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
		                    box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)
		            }
					.loginform{
						position: relative;
						margin: auto;
						top: 15%;
						width: 80%;
						height: 60%;
						padding-top: 5%;
					}
	</style>
	<%
                        	Room room=new Room();
                        	if(session.getAttribute("userloginflag")!=null){
                        	%>
                        	<script type="text/javascript">
                        	    window.location.href="app/main.jsp";
                        	</script>
                            <% }else{
                            %>
	<body onload="messageLoad()">
		<div class="bgdiv">
			<div class="loginbox">
				<div class="title">欢迎登录</div>
				<div class="loginform">
				<form method="post" onsubmit="return beforeSubmit()" action="UserLogin">
					<input name="username" id="username" type="text" placeholder="请输入账号" /><br /><br />
					<input name="password" id="password" type="password" placeholder="请输入密码" /><br />
					<span style="margin-top: 5px;float: left;font-size: 60%;color: skyblue;" onclick="Registered()">立即注册</span><span style="margin-top: 5px;float: right;font-size: 60%;color: brown;">忘记密码?</span><br />
					<span id="msg">
                             <%
                                           		String msg=null;

                                           		if(request.getAttribute("loginmsg")!=null){

                                           	%>
                                           		<font color="red">账号或密码错误</font>
                                           	<%} %></span><br />
					<button type="submit">登录</button>
				</form>
				</div>
			</div>
		</div>
	</body><% }%>
	<script>
	    if(/Android (\d+\.\d+)/.test(navigator.userAgent)){
	       var version = parseFloat(RegExp.$1);
	    if(version>2.3){
	       var phoneScale = parseInt(window.screen.width)/230;
	       document.write('<meta name="viewport" content="width=230, minimum-scale = '+ phoneScale +', maximum-scale = '+ phoneScale +', user-scalable=no, target-densitydpi=device-dpi">');
	       }else{
	            document.write('<meta name="viewport" content="width=230, target-densitydpi=device-dpi">');
	       }
	       }else{
	            document.write('<meta name="viewport" content="width=230, user-scalable=no, target-densitydpi=device-dpi">');
	       }
	       function Registered(){
                               window.location.href="app/registered/RegisteredForm.jsp";
                            }
           function beforeSubmit(){
                               if(document.getElementById('username').value==''){
                               alert('用户名不能为空！');
                               document.getElementById('username').focus();
                               return false;
                               }
                               if(document.getElementById('password').value==''){
                               alert('密码不能为空！');
                               document.getElementById('password').focus();
                               return false;
                               }
                               }
	</script>
</html>